<template>
<div>
  <div>
    <Button type="primary"  style="margin-left: 20px" @click="paizhao()">拍照</Button>
    <Button type="primary"  style="margin-left: 20px" @click="merge()">合并图像</Button>
    <Button type="primary"  style="margin-left: 20px" @click="recognition()">识别条形码</Button>
  </div>
  <div v-if="isRouterAlive">
    <div v-for="(item,index) in PathList" :key="index">
      图片位置：<strong>{{item}}</strong>
    </div>
  </div>
  <div v-if="isMsg">
      条形码或二维码信息：<strong>{{msg}}</strong>
  </div>
  <Modal
    v-model="mshow"
    title="高拍仪"
    @on-visible-change="modalChange3"  @on-cancel="closeHeight1" @on-ok="closeHeight1">
    <wl-equipment
      @getPath="getPath"
      @setMsg="setMsg"
      :file-path="filePath"
      :file-name="fileName"
      v-model="obj"
      :type="type"
      :is-open="openNow"
      ref="wlEquipment"
    ></wl-equipment>
  </Modal>
</div>
</template>

<script>
import WlEquipment from '../../../components/wl-equipment/index'
export default {
  name: 'index',
  components: { WlEquipment },
  data () {
    return {
      mshow: false,
      obj: {},
      type: 'heightCamera',
      filePath: 'gpy', // 上传图片地址
      fileName: '1.png', // 上传图片名称
      openNow: false,
      face_mol: false,
      // 控制打开or关闭拍照功能
      face_shows: false,
      // 高拍仪弹出框控制器
      gpy_mol: false,
      // 控制打开or关闭高拍仪功能
      gpy_shows: false,
      up_pic_mol: false,
      documentlist: [],
      imgModal: false,
      img: '',
      PathList: [],
      isRouterAlive: false,
      isMsg: false,
      msg: ''
    }
  },
  methods: {
    setMsg (e) {
      this.msg = e
      this.isMsg = false
      this.$nextTick(() => {
        this.isMsg = true
      })
    },
    modalChange3 (e) {
      this.openNow = e
    },
    closeHeight1 () {
      this.mshow = false
      this.openNow = false
    },
    paizhao () {
      this.$refs.wlEquipment.setPath()
      this.mshow = true
    },
    getPath (e) {
      this.PathList.push(e)
      this.mshow = false
      this.isRouterAlive = false
      this.$nextTick(() => {
        this.isRouterAlive = true
      })
    },
    merge () {
      this.$refs.wlEquipment.merge(this.PathList[0], this.PathList[1])
    },
    recognition () {
      console.log(111)
      this.$refs.wlEquipment.recognition(this.PathList[0])
    }
  }
}
</script>

<style scoped>

</style>
